package cn.edu.scau.cmi.wuyihan.composite.save;

import java.util.ArrayList;
import java.util.List;

public class Team extends Organization{
    
	private List<Organization> children = new ArrayList<>();
	
	public Team() {}
	
	public Team(String name) {
		this.name = name;
	}
	
	
	@Override
	public String getName() {
		return this.name;
	}
	
	public void addChildren(Organization organization) {
		this.children.add(organization);
	}
	
	public void deleteChildren(Organization organization) {
		this.children.remove(organization);
	}

	public List<Organization> getChildren() {
		return this.children;
	}

	public void setChildren(List<Organization> children) {
		this.children = children;
	}

	@Override
	public String toString() {
		StringBuilder stringBuilder = new StringBuilder();
		if (children.size() == 0) {
			return "";
		}
		stringBuilder.append("（团队，"+this.name+"）  --->  ");
		for(int i=0;i<children.size();i++) {
			stringBuilder.append(children.get(i).toString() + "  ");
		}
		
		return stringBuilder.toString();
	}

	
}
